﻿@model ThereAreNoIrreplaceblePeople.Models.Requests

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<table>
    <tr>
        <th>
            DATE
        </th>
        <th>
            SENDER
        </th>
        <th>
            RECEIVER
        </th>
        <th>
            SUBJECT
        </th>
        <th>
            STATUS
        </th>
        
    </tr>
<tr class="odd"><td colspan="5"><br />Your received requests:</td></tr>
@foreach (var item in Model.AsReceiverRequests) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.SenderID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ReceiverID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.SubjectName)
        </td>
        <td>
           <div class="display-field">
        @if (item.RequestStatus == 1)
        {
            <div class="display-field"> Accepted</div>
        }
        else if (item.RequestStatus == 2)
        {
            <div class="display-field"> Rejected</div>
        }else { 
            <div class="display-field"> Pending</div>
        }
    </div>
        </td>
    </tr>
}
<tr class="odd"><td colspan="5"><br />Your sent requests:</td></tr>
@foreach (var item in Model.AsSenderRequests)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.SenderID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ReceiverID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.SubjectName)
        </td>
        <td>
           <div class="display-field">
        @if (item.RequestStatus == 1)
        {
            <div class="display-field"> Accepted</div>
        }
        else if (item.RequestStatus == 2)
        {
            <div class="display-field"> Rejected</div>
        }
        else
        { 
            <div class="display-field"> Pending</div>
        }
    </div>
        </td>
    </tr>
}
</table>
